<?
/**
 * SWF格式验证码生成功能
 * （大小建义为：width="100" height="40"）
 * 
 * @copyright Copyright (c) 2008 sdmblog (http://www.sdmblog.cn)
 * @author sdomain(sdomain@live.cn)
 * @version flvcode.php Sat May 17 17:11:18 CST 2008 php $
 */
header('Content-type: application/x-shockwave-flash');
header('Cache-Control: no-cache, must-revalidate');
session_start(); 
$auth_num=""; 
session_unregister('auth_num'); 
session_register('auth_num'); 
srand((double)microtime()*10000000); 
$auth_num_k=rand(999999999,99999999999999999); 
$auth_num=substr($auth_num_k,2,5); //最终的验证码
$f = new SWFFont( '_sans' );
$pt = new SWFTextField();
$pt->setFont( $f );
$pt->setColor( 0, 0, 0 );
$pt->setHeight( 10 );
$pt->addString( $auth_num );
$tt = new SWFTextField();
$tt->setFont( $f );
$tt->setColor( 192, 192, 192, 90 );
$tt->setHeight( 40 );                                                                                                                                                                                                                                                                                                                                                     $tt->addString( 'SDM' );
$m = new SWFMovie();
$m->setDimension( 80,40);
$pts = $m->add( $pt );
$pts->moveTo( 0, 0 );
$tts = $m->add( $tt );
$tts->moveTo( 0, 0 );
for( $i = 0; $i < 10; $i++ ) {
 $m->nextframe();
 $pts->scaleTo( 3.0 + ( $i / 10.0 ), 2.0 + ( $i / 10.0 ) );
}
for( $i = 0; $i < 20; $i++ ) {
 $pts->moveTo($i*10,0);
 $m->nextframe();
}
$m->output( );
?>